package cn.com.w.jackson.demo.controller;

import cn.com.w.jackson.demo.entity.UserInfo;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RestController
@RequestMapping("/user")
public class UserInforController {


    @PostMapping("/add")
    public UserInfo addUser(@RequestBody UserInfo userInfo){
        return userInfo;
    }


    /**
     * 返回结果
     * {
     *     "id": null,
     *     "userName": null,
     *     "userAge": null,
     *     "userNo": null,
     *     "userSex": null,
     *     "userPhone": null,
     *     "userLoginName": null,
     *     "userPassword": null,
     *     "userLevel": null,
     *     "createTime": "2022-06-29T06:35:21.464+00:00",
     *     "updateTime": "2022-06-29T06:35:21.464+00:00",
     *     "deleteFlag": null
     * }
     *
     *
     * {
     *     "id": null,
     *     "userName": null,
     *     "userAge": null,
     *     "userNo": null,
     *     "userSex": null,
     *     "userPhone": null,
     *     "userLoginName": null,
     *     "userPassword": null,
     *     "userLevel": null,
     *     "createTime": "2022-06-29 02:37:00",
     *     "updateTime": "2022-06-29T06:37:00.835+00:00",
     *     "deleteFlag": null
     * }
     * @return
     */
    @GetMapping("/time")
    public UserInfo getUserCreateTime(){
        UserInfo userInfo = new UserInfo();
        userInfo.setCreateTime(new Date());
        userInfo.setUpdateTime(new Date());
        return userInfo;
    }

}
